import { observable, action } from "mobx";
import app from "../../apis/app";

export default class AppListStore {
  @observable apps = null;
  @observable searchText = '';

  @action init = () => {
    app.getApps().then(data => {
      if (data.sessionkey) {
        const dataKey = data.sessionkey.datas;

        app.getDatas(dataKey).then(res => {
          this.apps = res.datas;
        });
      }
    });
  }

  @action onSearchTextChange = text => {
    this.searchText = text;
  }
}